const express = require('express')
const {zzshequpinglunModel} = require('../model/models')
const router = express.Router()

router.get('/catepl',async(req,res)=>{
    const id = req.query.id
    if(id){
        const data = await zzshequpinglunModel.find({p_id:id})
        res.send({
            code:200,
            data
        })
    }else{
        res.send({
            code:404,
            
        })
    }
})

router.post('/zzpinglun',async (req,res)=>{
    const data = await zzshequpinglunModel.create(req.body)
    res.send({
        code:200,
        data
    })

})

module.exports = router